﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Data;

namespace hostal
{
    public partial class VerConsumo : Form
    {
        DataTable temp = new DataTable();
        string habitacion;
        public VerConsumo(string h)
        {
            InitializeComponent();
            habitacion = h;
            label1.Text = "Consumo habitacion : " + h;
        }

        private void VerConsumo_Load(object sender, EventArgs e)
        {
            //DGConsumo.Columns.Add("idproducto", "idproducto");
            DGConsumo.Columns.Add("nombre", "producto");
            DGConsumo.Columns.Add("precio", "precio");
            //DataGridViewCheckBoxColumn cons = new DataGridViewCheckBoxColumn();
            //cons.DataPropertyName = "consumido";
            //cons.HeaderText = " ";
            //DGConsumo.Columns.Add(cons);
            DGConsumo.Columns.Add("cantidad", "cantidad");

            ConsumoDataAccess dal = new ConsumoDataAccess();
            temp = dal.buscarConsumo(habitacion);

            for (int i = 0; i < temp.Rows.Count; i++)
            {
                DGConsumo.Rows.Add(temp.Rows[i]["nombre"].ToString(), temp.Rows[i]["precio"].ToString(), temp.Rows[i]["cantidad"].ToString());
            }
            label3.Text = dal.total(habitacion);
        }

        private void DGConsumo_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
